package com.ruoyi.qxk.rabmq.listener;

import com.ruoyi.qxk.domain.RepairReservation;
import com.ruoyi.qxk.service.IRepairReservationService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @className: yuYueListenter
 * @author: xikun
 * @date: 2025/5/20 14:51
 * @Version: 1.0
 * @description:
 */
@Component
public class yuYueListenter {
    //维修任务
    @Autowired
    private IRepairReservationService repairReservationService;
    //监听死信队列
    @RabbitListener(queues = "yuYue_queue2")
    public void yuYueListener(RepairReservation repairReservation) {
        //判断订单状态
        int i = repairReservationService.selectStatusById(repairReservation.getId());
        if (i == 1) {
            System.out.println("已经接单");
        }else if (i==0){
            int i1 = repairReservationService.deleteRepairReservationById(repairReservation.getId());
            System.out.println("取消订单"+i1);
        }
    }
}
